package com.qingke.memo.command.system;

import java.util.Date;

import com.qingke.memo.command.SystemCommand;
import com.qingke.memo.pojo.Memo;
import com.qingke.memo.unit.MConsole;

public class CreateMemo extends SystemCommand {

	@Override
	public void execute() {
		Memo memo=new Memo();
		String title=MConsole.promptNotEmpty("title:");
		Date createTime=new Date();
		String content=MConsole.promptNotEmpty("content:");
		memo.setTitle(title);
		memo.setCreateTime(createTime);
		memo.setContent(content);
		
		boolean isSuccess=dao.insertMemo(memo);
		if(isSuccess)
			MConsole.println("create memo success.");
		else
			MConsole.println("create memo failed.");
	}

}
